package com.itheima.stream;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.stream.Stream;

public class StreamDemo02 {
    public static void main(String[] args) {
        //单列集合
        //method01();
        //双列集合
        //method02();
        //数组
        //method03();
        //相同类型的多个数据
        //method04();
    }

    private static void method04() {
        Stream.of(1,3,4,5,7).forEach(s-> System.out.println(s));
    }

    private static void method03() {
        int[] arr={1,2,3,4};
        Arrays.stream(arr).forEach(s-> System.out.println(s));
    }

    private static void method02() {
        HashMap<String,Integer> list=new HashMap<>();
        list.put("zhangsan",18);
        list.put("lisi",19);
        list.put("wangwu",20);
        list.keySet().stream().forEach(s-> System.out.println(s));
        list.entrySet().stream().forEach(s-> System.out.println(s));
    }

    private static void method01() {
        ArrayList<String> list=new ArrayList<>();
        list.add("aaa");
        list.add("ddd");
        list.add("ccc");
        list.stream().forEach(s-> System.out.println(s));
    }
}
